@extends('admin.public.layout')
@section('title', '登录日志列表')

@section('css')
<!--时间选择插件-->
<link rel="stylesheet" href="{{asset('static/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.css')}}">
@endsection

@section('content')
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    <form class="pull-left search-bar" method="post" action="{{ url('admin/admin_loginlog/index')}}">
                        <input type="hidden" name="_token" value="{{ csrf_token() }}"/>
                        <div class="col-xs-3 m-t-10">
                            <div class="input-group">
                                <span class="input-group-addon" id="basic-addon1">用户名</span>
                                <input type="text" class="form-control" name="name" placeholder="请输入用户名" aria-describedby="basic-addon1" value="<?php if(!empty($params['name'])){ ?>{{$params['name']}}<?php }?>">
                            </div>
                        </div>
                        <div class="col-xs-3 m-t-10">
                            <div class="input-group">
                                <span class="input-group-addon" id="basic-addon1">姓名</span>
                                <input type="text" class="form-control" name="true_name" placeholder="请输入姓名" aria-describedby="basic-addon1" value="<?php if(!empty($params['true_name'])){ ?>{{$params['true_name']}}<?php }?>">
                            </div>
                        </div>
                        <div class="col-xs-3 m-t-10">
                            <div class="input-group">
                                <span class="input-group-addon" id="basic-addon1">登录状态</span>
                                <select class="form-control" id="example-select" name="status">
                                    <option value="">请选择</option>
                                    <option value="1" <?php if(isset($params['status']) && $params['status'] == 1){ ?>selected<?php } ?>>成功</option>
                                    <option value="0" <?php if(isset($params['status']) && $params['status'] == 0){ ?>selected<?php } ?>>失败</option>
                                </select>
                            </div>
                        </div>
                        <div class="col-xs-6 m-t-10">
                            <div class="input-group">
                                <span class="input-group-addon" id="basic-addon1">时间查询</span>
                                <input class="form-control js-datetimepicker" type="text" id="begin_time" name="begin_time" placeholder="请选择开始时间" value="<?php if(!empty($params['begin_time'])){ ?>{{$params['begin_time']}}<?php }?>" data-side-by-side="true" data-locale="zh-cn" data-format="YYYY-MM-DD" />
                                <span class="input-group-addon"><i class="mdi mdi-chevron-right"></i></span>
                                <input class="form-control js-datetimepicker" type="text" id="end_time" name="end_time" placeholder="请选择结束时间" value="<?php if(!empty($params['end_time'])){ ?>{{$params['end_time']}}<?php }?>" data-side-by-side="true" data-locale="zh-cn" data-format="YYYY-MM-DD" />
                            </div>
                        </div>
                        <div class="col-xs-3 m-t-10 pull-left">
                            <div class="input-group">
                                <button class="btn btn-info btn-w-xs m-r-10" type="submit">查询</button>
                                <button class="btn btn-secondary btn-w-xs m-r-10 reset-btn" type="button">重置</button>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-bordered table-hover table-striped">
                            <thead>
                            <tr>
                                <th width="15%">用户名</th>
                                <th width="15%">姓名</th>
                                <th width="15%">登录状态</th>
                                <th width="15%">登录信息</th>
                                <th width="15%">登录ip</th>
                                <th width="15%">登录时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if (count($list) > 0)
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td>{{$v->admin_name}}</td>
                                        <td>{{$v->true_name}}</td>
                                        <td>
                                            @if($v->status == 1)
                                                <a href="javascript:void(0)" class="label label-success">成功</a>
                                            @else
                                                <a href="javascript:void(0)" class="label label-danger">失败</a>
                                            @endif
                                        </td>
                                        <td>
                                            {{$v->remark}}
                                        </td>
                                        <td>
                                            {{$v->action_ip}}
                                        </td>
                                        <td>
                                            {{date('Y-m-d H:i:s',$v->action_time)}}
                                        </td>
                                    </tr>
                                @endforeach
                            @else
                                <tr>
                                    <td colspan="6" style="text-align: center;color:#ff0000;">查询数据不存在！</td>
                                </tr>
                            @endif
                            </tbody>
                        </table>
                    </div>
                    {!! $pager !!}
                </div>
            </div>
        </div>
    </div>
@endsection

@section('js')
<!--时间选择插件-->
<script src="{{asset('static/js/bootstrap-datetimepicker/moment.min.js')}}"></script>
<script src="{{asset('static/js/bootstrap-datetimepicker/bootstrap-datetimepicker.min.js')}}"></script>
<script src="{{asset('static/js/bootstrap-datetimepicker/locale/zh-cn.js')}}"></script>
@endsection